Question: Each interior angle of a regular polygon measures $140^\circ$. How many sides does the polygon have?
Answer: Let $n$ be the number of sides in the polygon.  The sum of the interior angles in any $n$-sided polygon is $180(n-2)$ degrees.  Since each angle in the given polygon measures $140^\circ$, the sum of the interior angles of this polygon is also $140n$.  Therefore, we must have  \[180(n-2) = 140n.\] Expanding the left side gives $180n - 360 = 140n$, so $40n = 360$ and $n = \boxed{9}$.

We might also have noted that each exterior angle of the given polygon measures $180^\circ - 140^\circ = 40^\circ$.  The exterior angles of a polygon sum to $360^\circ$, so there must be $\frac{360^\circ}{40^\circ} = 9$ of them in the polygon.